/**
 * handles end conditions
 */
package main;

public class Condition {

	protected Player Owner;
	protected String Name;
	protected int pointvalue;
	protected boolean complete=false;
	
	/**
	 * constructor
	 * @param o - player owner
	 * @param value - point value of end
	 */
	public Condition(Player o, int value){
		Owner=o;
		pointvalue=value;
	}
	
	/**
	 * check if condition is reached
	 * returns true if complete, false otherwise
	 */
	public boolean checkComplete(){
		if(!complete)
			return false;
		else{
			complete();
			return true;
		}
	}
	
	/**
	 * completes the end condition (turns complete true, adds points)
	 */
	public void complete(){
		complete=true;
		Owner.getRes().getScore().AddToScore(pointvalue);
	}
	
	/**
	 * returns completed state
	 * @return boolean
	 */
	public boolean isComplete(){
		return complete;
	}
	
}
